<template>
  <div class="baby">
    <div class="w-banner">
      <img
        src="https://www.uniqlo.cn/cms/806543d6337d0f861cf556330f989673.jpg"
        alt=""
      />
    </div>

    <p class="hot">热门推荐</p>

    <div class="goodslist">
      <div
        class="item"
        v-for="(l, i) in babylist"
        :key="i"
        @click="gotodetail(l.id)"
      >
        <img :src="l.goodsimg" alt="" />
        <p>婴幼儿装</p>
        <p class="name">{{ l.goodsname }}</p>
        <p class="price">¥{{ l.goodsprice }}</p>
        <p class="discount">限时优惠</p>
        <p class="preprice">初上市的价格¥{{ l.preprice }}</p>
      </div>

      <div class="btnbox">
         <van-button class="btn" type="primary" block>查看更多新作商品</van-button>
      </div>

      <div class="kong"></div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      babylist: [],
    };
  },
  methods: {},
  mounted() {
    axios.get("http://localhost:2101/baby").then((res) => {
      console.log(res);
      this.babylist = res.data;
    });
  },
};
</script>

<style lang="scss" scoped>
.baby {
  margin-top: 60px;
  .w-banner {
    width: 100%;
    height: 500px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .hot {
    font-size: 20px;
    line-height: 50px;
    font-weight: 600px;
    background: #fff;
    padding: 0 15px;
    font-weight: bold;
     margin-top: 10px;
  }
  .goodslist {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 0 10px;
    .item {
      width: 48%;
      background: #fff;
      margin-bottom: 10px;
      img {
        width: 100%;
      }
      p {
        width: 150px;
        font-size: 13px;
        color: #1b1b1b;
        text-align: left;
        margin: 8px 15px;
      }
      .name {
        line-height: 16px;
      }
      .price {
        font-size: 18px;
        color: #ff0000;
        font-weight: bold;
      }
      .discount {
        color: #ff0000;
      }
      .preprice {
        font-size: 12px;
      }
    }
  }
  .btnbox {
    margin-top: 10px;
    width: 100%;
    height: 50px;
    position: relative;
    .btn {
      width: 80%;
      height: 35px;
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      right: 0;
      margin: auto;
      border: 1px solid #1b1b1b;
      text-align: center;
      line-height: 35px;
      font-size: 18px;
      font-weight: 600px;
      font-weight: bold;
      color: #333;
    }
  }
  .kong {
    width: 100%;
    height: 100px;
  }
}
</style>